-
-
Notifications
You must be signed in to change notification settings - Fork 258
Fix: major revision to valid and invalid numeric literal separator "sibling" characters #745
Conversation
…ibling" characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use allowedNumericSeparatorSlibings
instead of forbiddenNumericSeparatorSlibings
when checking if the caracter before the separator is valid?
src/tokenizer/index.js
Outdated
bin: [ | ||
// 0 - 1 | ||
48, 49, | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I would like to avoid repeating all the numbers... What do you think about doing something like this?
const allowedNumericSeparatorSiblings = {};
allowedNumericSeparatorSiblings.bin = [ 48, 49 ];
allowedNumericSeparatorSiblings.oct = [
...allowedNumericSeparatorSiblings.bin, 50, 51, 52, 53, 54, 55,
];
allowedNumericSeparatorSiblings.dec = [
...allowedNumericSeparatorSiblings.oct, 56, 57,
];
It wouldn't have a too big performance impact, since they would be computed only when babylon is loaded.
Anyway, It's up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can do that.
Looks like I have to update to use |
@rwaldron Can you fix the linting errors? |
Looks nice the way it is, but prettier wants the newlines.. |
Thanks @rwaldron!! |
Sorry I missed these follow-up messages, I've been afk since Thursday evening. |
As a result of testing the Babel transform against NLS tests pending for test262, I discovered a pretty serious oversight in my original parsing. This addresses that issue and adds a substantial amount of tests.